package com.sicheng.lc.周赛.分类.位运算;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/24 10:30
 */
public class 第一个出现两次的字母 {
    public char repeatedCharacter(String s) {
        int bit = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if ((bit >> (c - '0') & 1) == 0)
                bit |= 1 << (c - '0');
            else
                return c;
        }
        return ' ';
    }
}
